package com.baozun.houji.goods.viewmodel.state

import androidx.lifecycle.MutableLiveData
import com.baozhun.mall.common.model.bean.GoodsInfoBean
import com.baozun.houji.goods.network.homeApiService
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

class SearchViewModel : BaseViewModel() {
    var recommendList = MutableLiveData<ResultState<List<GoodsInfoBean>>>()
    var associativeList = MutableLiveData<ResultState<MutableList<String>>>()
    var historyIsEmpty = MutableLiveData<Boolean>()


    fun getSearchRecommend() {
        request({ homeApiService.getSearchRecommend() }, recommendList)
    }

    fun getSearchAssociative(keywords: String) {
        request({ homeApiService.getSearchAssociative(keywords) }, associativeList, false)
    }
}